package com.pinda.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pinda.auth.entity.PdCoreOrg;
import com.pinda.auth.view.PdCoreOrgView;
import com.pinda.feign.PdAreaFeignClient;
import com.pinda.mapper.PdAuthUserMapper;
import com.pinda.mapper.PdCoreOrgMapper;
import com.pinda.service.IPdCoreOrgService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 组织 服务实现类
 * </p>
 *
 * @author author
 * @since 2023-06-24
 */
@Service
public class PdCoreOrgServiceImpl extends ServiceImpl<PdCoreOrgMapper, PdCoreOrg> implements IPdCoreOrgService {

    @Resource
    private PdCoreOrgMapper pdCoreOrgMapper;
    @Resource
    private PdAuthUserMapper pdAuthUserMapper;
    @Resource
    private PdAreaFeignClient pdAreaFeignClient;

    @Override
    public PdCoreOrgView findCoreOrgUserService() {
        return PdCoreOrgView.builder()
                .users(this.pdAuthUserMapper.selectList(null))
                .organization(this.pdCoreOrgMapper.selectList(null))
                .areas(this.pdAreaFeignClient.findarea())
                .build();
    }

    @Override
    public PdCoreOrg latitudeAndLongitude(long id) {
        PdCoreOrg pdCoreOrg = pdCoreOrgMapper.selectById(id);
        return pdCoreOrg;
    }

    @Override
    public void jgfaweistate(PdCoreOrg pdOrg) {
        System.out.println("----------------------------");

        this.pdCoreOrgMapper.updateCoreOrg(pdOrg.getId());
        System.out.println("----------------------------");
    }
}
